//
//  WEIBOStatuseCell.m
//  OneWeiBo
//
//  Created on 13.
//   
//

#import "WEIBOStatusCell.h"
#import "WEIBOStatusframe.h"
#import "WEIBOStatus.h"
#import "WEIBOStatusToolBar.h"

@interface WEIBOStatusCell()

@property (nonatomic, strong) WEIBOStatusframe *statusFrame;

// 微博工具条
@property (nonatomic, weak) WEIBOStatusToolBar *statusToolBar;

@end
@implementation WEIBOStatusCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        // 添加微博工具条
        [self setupStatusToolBar];
    }
    return self;
}

+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *ID = @"statusCell";
    WEIBOStatusCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[WEIBOStatusCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    return cell;
}

/**
 * 添加微博工具条
 */
- (void)setupStatusToolBar
{
    // 微博工具条
    WEIBOStatusToolBar *statusToolBar = [[WEIBOStatusToolBar alloc]init];
    [self.contentView addSubview:statusToolBar];
    self.statusToolBar = statusToolBar;

}

/**
 *  传递模型数据
 */
- (void)setStatusFrame:(WEIBOStatusframe *)statusFrame
{
    [super setStatusFrame:statusFrame];
    
    // 微博工具条
    [self setupStatusToolBarData];
}

- (void)setupStatusToolBarData
{
    // 设置ToolBar frame
    self.statusToolBar.frame = self.statusFrame.statusToolBarFrame;
    // 设置ToolBar数据
    self.statusToolBar.status = self.statusFrame.status;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
